<?php
require_once 'libraries/functions.php';
echo "Sua thong tin: " . "<br>";
$path = "../ptnhuan-web1/data/films.txt";
$full_path = realpath($path);
$films = mreadFile($path);
?>
<form method='post' action="edit.php">
    <?php foreach ($films as $item): ?>
        <?php
        $filter = trim($item, "\n\t\r ");
        $film = explode(";",$filter);
        if ($_GET["if"] == $film[0]):
            ?>
            <table>
                <tr>
                <img src = '../ptnhuan-web1/public/images/films/<?php echo $film[1] ?>'>
                </tr>
                <tr>
                    <td>Ten :</td>
                    <td><input type='text' name='name' size='80'value="<?php echo $film[2] ?>"></td>
                </tr>            
                <tr>
                    <td>Rating :</td>
                    <td><input type='text' name='rating' size='80' value="<?php echo $film[3] ?>"></td>
                </tr>
            </table>
            <p><input type='submit' value='Sua'></p>
            <?php echo '<a href="file.php">Bam vao day de quay lai<br></a>'; ?>
        <?php endif; ?>
    <?php endforeach; ?>
</form>